<?php

namespace App\Admin\Controllers;

use Encore\Admin\Layout\Content;
use Carbon\Carbon;
use App\Models\CollectionImage;
use App\Models\SeckillProduct;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Encore\Admin\Controllers\AdminController;

class CollectionImagesController extends AdminController
{
    protected $title = '合成图列表';

    
    protected function grid()
    {
        $grid = new Grid(new CollectionImage());
	    
        $grid->model()->where('collection_id', request('collection_id'))->orderByDesc('id');

	    $grid->disableExport();
	    
	    $grid->column('id', 'ID');
        $grid->column('image', '图片')->lightbox(['width' => 50, 'height' => 50]);
        $this->gridActions($grid);
      
        return $grid;
    }
    
    protected function gridActions(Grid $grid)
    {
        $grid->actions(function (Grid\Displayers\Actions $actions) {
            $actions->disableView();
        });
    }


    protected function detail($id)
    {
        $show = new Show(CollectionImage::findOrFail($id));

        return $show;
    }

    
    protected function form()
    {
        $form = new Form(new CollectionImage());
        $form->image('image', 'IMG')->uniqueName()->help('NOTE：保证清晰的前提下尽可能压缩体积');
       // $this->formSaved($form);

        return $form;
    }

   
  
}
